package com.powerbank.financecenter.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 交易记录实体类
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("transaction_record")
public class TransactionRecord {

    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 交易号
     */
    @TableField("transaction_no")
    private String transactionNo;

    /**
     * 用户ID
     */
    @TableField("user_id")
    private Long userId;

    /**
     * 账户ID
     */
    @TableField("account_id")
    private Long accountId;

    /**
     * 交易类型：RECHARGE-充值，CONSUME-消费，REFUND-退款，WITHDRAW-提现，TRANSFER-转账
     */
    @TableField("transaction_type")
    private String transactionType;

    /**
     * 交易方向：IN-收入，OUT-支出
     */
    @TableField("direction")
    private String direction;

    /**
     * 交易金额
     */
    @TableField("amount")
    private BigDecimal amount;

    /**
     * 交易前余额
     */
    @TableField("balance_before")
    private BigDecimal balanceBefore;

    /**
     * 交易后余额
     */
    @TableField("balance_after")
    private BigDecimal balanceAfter;

    /**
     * 交易状态：PENDING-待处理，SUCCESS-成功，FAILED-失败，CANCELLED-已取消
     */
    @TableField("status")
    private String status;

    /**
     * 关联订单号
     */
    @TableField("order_no")
    private String orderNo;

    /**
     * 关联支付号
     */
    @TableField("payment_no")
    private String paymentNo;

    /**
     * 支付方式：ALIPAY-支付宝，WECHAT-微信，BANK-银行卡，WALLET-钱包
     */
    @TableField("payment_method")
    private String paymentMethod;

    /**
     * 交易描述
     */
    @TableField("description")
    private String description;

    /**
     * 备注
     */
    @TableField("remark")
    private String remark;

    /**
     * 创建时间
     */
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    private LocalDateTime createdTime;

    /**
     * 更新时间
     */
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedTime;

    /**
     * 是否删除：0-否，1-是
     */
    @TableLogic
    @TableField("deleted")
    private Integer deleted;
}